{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "24604ca6",
   "metadata": {},
   "outputs": [],
   "source": [
    "import asyncio"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8fa9d263",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "434f62b2",
   "metadata": {},
   "outputs": [],
   "source": [
    "async def my_coro(dut, name):\n",
    "    for i in range(10):\n",
    "        print(f\"{name}: {i}\")\n",
    "        await dut.AStep(1)\n",
    "\n",
    "async def test_dut(dut):\n",
    "    asyncio.create_task(my_coro(dut, \"coroutine 1\"))\n",
    "    asyncio.create_task(my_coro(dut, \"coroutine 2\"))\n",
    "    await asyncio.create_task(dut.RunStep(10))\n",
    "\n",
    "asyncio.run(test_dut(dut))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "cb0dd1d7",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<coroutine object foo at 0x7e92b5fdce00>\n",
      "\n",
      "<function foo at 0x7e92b5d019e0>\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/tmp/ipykernel_285874/580463177.py:4: RuntimeWarning: coroutine 'foo' was never awaited\n",
      "  print(foo())\n",
      "RuntimeWarning: Enable tracemalloc to get the object allocation traceback\n"
     ]
    }
   ],
   "source": [
    "async def foo():\n",
    "    return 42\n",
    "\n",
    "print(foo()) \n",
    "print()\n",
    "print(foo)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": ".venv",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
